//
//  CEPageLog.m
//  CELog_Example
//
//  Created by maoerduo on 2021/2/25.
//  Copyright © 2021 maoerduo. All rights reserved.
//

#import "CEPageLog.h"

@interface CEPageLog()

@property (nonatomic, strong) NSMutableDictionary<NSString *, NSString *> * log;

@end

@implementation CEPageLog

- (instancetype)initWithPageName:(NSString *)pageName log:(NSDictionary<NSString *, NSString *> * _Nullable)log {
    self = [super init];
    if (self) {
        self.pageName = pageName;
        self.log = [NSMutableDictionary dictionary];
        
        [log enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) {
            self.log[key] = obj;
        }];
        
        self.log[@"event_name"] = @"page";
        self.log[@"pageName"] = pageName;
        
    }
    return self;
}

- (NSDictionary<NSString *,NSString *> *)content {
    return self.log;
}

@end
